﻿
using System.Runtime.Serialization;
using TpBaseObjects.Base;

namespace TpBaseObjects.Objects {

    public class Person : MyBaseModel {

        #region Members

        private int persKey;
        private string persTS;
        private string aenderung;
        private string zuname;
        private string vorname;
        private short geschlecht;
        private int titel1Key;
        private int titel2Key;
        private string adresse;
        private int eplz;
        private string straße;
        private int vorwahlKey;
        private string mobil;
        private string privTelefon;
        private string privFax;
        private bool mailingSperre;
        private string notiz;
        private bool mitarbeiter;
        private string kuerzel;
        private string email;
        private int orgKey;
        //PersOrg
        private int funktionsKey;
        private int berufstitelKey;
        private string durchwahl;
        private string fax;
        private string taetigkeit;

        #endregion

        #region Constructor

        public Person() {
        }

        #endregion
        
        #region Properties

        [DataMember]
        public int PersKey {
            get { return this.persKey; }
            set {
                if (this.persKey == value) {
                    return;
                }
                this.persKey = value;
                OnPropertyChanged(() => PersKey);
            }
        }

        [DataMember]
        public string PersTS {
            get { return this.persTS; }
            set {
                if (this.persTS == value) {
                    return;
                }
                this.persTS = value;
                OnPropertyChanged(() => PersTS);
            }
        }

        [DataMember]
        public string Änderung {
            get { return this.aenderung; }
            set {
                if (this.aenderung == value) {
                    return;
                }
                this.aenderung = value;
                OnPropertyChanged(() => Änderung);
            }
        }

        [DataMember]
        public string Zuname {
            get { return this.zuname; }
            set {
                if (this.zuname == value) {
                    return;
                }
                this.zuname = value;
                OnPropertyChanged(() => Zuname);
            }
        }

        [DataMember]
        public string Vorname {
            get { return this.vorname; }
            set {
                if (this.vorname == value) {
                    return;
                }
                this.vorname = value;
                OnPropertyChanged(() => Vorname);
            }
        }

        [DataMember]
        public short Geschlecht {
            get { return this.geschlecht; }
            set {
                if (this.geschlecht == value) {
                    return;
                }
                this.geschlecht = value;
                OnPropertyChanged(() => Geschlecht);
            }
        }

        [DataMember]
        public int Titel1Key {
            get { return this.titel1Key; }
            set {
                if (this.titel1Key == value) {
                    return;
                }
                this.titel1Key = value;
                OnPropertyChanged(() => Titel1Key);
            }
        }

        [DataMember]
        public int Titel2Key {
            get { return this.titel2Key; }
            set {
                if (this.titel2Key == value) {
                    return;
                }
                this.titel2Key = value;
                OnPropertyChanged(() => Titel2Key);
            }
        }

        [DataMember]
        public string Adresse {
            get { return this.adresse; }
            set {
                if (this.adresse == value) {
                    return;
                }
                this.adresse = value;
                OnPropertyChanged(() => Adresse);
            }
        }

        [DataMember]
        public int EPLZ {
            get { return this.eplz; }
            set {
                if (this.eplz == value) {
                    return;
                }
                this.eplz = value;
                OnPropertyChanged(() => EPLZ);
            }
        }

        [DataMember]
        public string Straße {
            get { return this.straße; }
            set {
                if (this.straße == value) {
                    return;
                }
                this.straße = value;
                OnPropertyChanged(() => Straße);
            }
        }

        [DataMember]
        public int VorwahlKey {
            get { return this.vorwahlKey; }
            set {
                if (this.vorwahlKey == value) {
                    return;
                }
                this.vorwahlKey = value;
                OnPropertyChanged(() => VorwahlKey);
            }
        }

        [DataMember]
        public string Mobil {
            get { return this.mobil; }
            set {
                if (this.mobil == value) {
                    return;
                }
                this.mobil = value;
                OnPropertyChanged(() => Mobil);
            }
        }

        [DataMember]
        public string PrivTelefon {
            get { return this.privTelefon; }
            set {
                if (this.privTelefon == value) {
                    return;
                }
                this.privTelefon = value;
                OnPropertyChanged(() => PrivTelefon);
            }
        }

        [DataMember]
        public string PrivFax {
            get { return this.privFax; }
            set {
                if (this.privFax == value) {
                    return;
                }
                this.privFax = value;
                OnPropertyChanged(() => PrivFax);
            }
        }

        [DataMember]
        public bool MailingSperre {
            get { return this.mailingSperre; }
            set {
                if (this.mailingSperre == value) {
                    return;
                }
                this.mailingSperre = value;
                OnPropertyChanged(() => MailingSperre);
            }
        }

        [DataMember]
        public string Notiz {
            get { return this.notiz; }
            set {
                if (this.notiz == value) {
                    return;
                }
                this.notiz = value;
                OnPropertyChanged(() => Notiz);
            }
        }

        [DataMember]
        public bool Mitarbeiter {
            get { return this.mitarbeiter; }
            set {
                if (this.mitarbeiter == value) {
                    return;
                }
                this.mitarbeiter = value;
                OnPropertyChanged(() => Mitarbeiter);
            }
        }

        [DataMember]
        public string Kürzel {
            get { return this.kuerzel; }
            set {
                if (this.kuerzel == value) {
                    return;
                }
                this.kuerzel = value;
                OnPropertyChanged(() => Kürzel);
            }
        }

        [DataMember]
        public string EMail {
            get { return this.email; }
            set {
                if (this.email == value) {
                    return;
                }
                this.email = value;
                OnPropertyChanged(() => EMail);
            }
        }

        //PersOrg
        [DataMember]
        public int OrgKey {
            get { return this.orgKey; }
            set {
                if (this.orgKey == value) {
                    return;
                }
                this.orgKey = value;
                OnPropertyChanged(() => OrgKey);
            }
        }

        [DataMember]
        public int FunktionsKey {
            get { return this.funktionsKey; }
            set {
                if (this.funktionsKey == value) {
                    return;
                }
                this.funktionsKey = value;
                OnPropertyChanged(() => FunktionsKey);
            }
        }

        [DataMember]
        public int BerufstitelKey {
            get { return this.berufstitelKey; }
            set {
                if (this.berufstitelKey == value) {
                    return;
                }
                this.berufstitelKey = value;
                OnPropertyChanged(() => BerufstitelKey);
            }
        }

        [DataMember]
        public string Durchwahl {
            get { return this.durchwahl; }
            set {
                if (this.durchwahl == value) {
                    return;
                }
                this.durchwahl = value;
                OnPropertyChanged(() => Durchwahl);
            }
        }

        [DataMember]
        public string Fax {
            get { return this.fax; }
            set {
                if (this.fax == value) {
                    return;
                }
                this.fax = value;
                OnPropertyChanged(() => Fax);
            }
        }

        [DataMember]
        public string Tätigkeit {
            get { return this.taetigkeit; }
            set {
                if (this.taetigkeit == value) {
                    return;
                }
                this.taetigkeit = value;
                OnPropertyChanged(() => Tätigkeit);
            }
        }

        [DataMember]
        public string SelectPerson {
            get { return Zuname + " " + Vorname; }
        }

        [DataMember]
        public bool SendToThisPerson { get; set; }

        private bool isDirty;
        public bool IsDirty {
            get { return this.isDirty; }
            set {
                if (this.isDirty == value) {
                    return;
                }
                this.isDirty = value;
                OnPropertyChanged(() => IsDirty);
            }
        }

        #endregion

        #region Overrides

        public override string ToString() {
            string ret = "";
            ret += Vorname + " " + Zuname;
            return ret;
        }

        #endregion

    }
}
